using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class v_appymtMap : EntityTypeConfiguration<v_appymt>
    {
        public v_appymtMap()
        {
            // Primary Key
            this.HasKey(t => new { t.vendname, t.acct, t.acctname, t.currency, t.batch, t.reference, t.costcenter, t.pv });

            // Properties
            this.Property(t => t.vendid)
                .HasMaxLength(6);

            this.Property(t => t.vendname)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.acct)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.acctname)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.currency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.batch)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.reference)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.check)
                .HasMaxLength(9);

            this.Property(t => t.costcenter)
                .IsRequired()
                .HasMaxLength(9);

            this.Property(t => t.description)
                .HasMaxLength(40);

            this.Property(t => t.pv)
                .IsRequired()
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("v_appymt");
            this.Property(t => t.vendid).HasColumnName("vendid");
            this.Property(t => t.vendname).HasColumnName("vendname");
            this.Property(t => t.acct).HasColumnName("acct");
            this.Property(t => t.acctname).HasColumnName("acctname");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.reference).HasColumnName("reference");
            this.Property(t => t.check).HasColumnName("check");
            this.Property(t => t.costcenter).HasColumnName("costcenter");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.pv).HasColumnName("pv");
            this.Property(t => t.amountacct).HasColumnName("amountacct");
            this.Property(t => t.amount).HasColumnName("amount");
            this.Property(t => t.amountdol).HasColumnName("amountdol");
        }
    }
}
